<!-- 用选择性Api，创建从1到100的累加 -->
<script setup lang="ts">
import { onMounted, ref } from "vue";

const sum = ref(0);
onMounted(() => {
  for (let i = 1; i <= 100; i++) {
    sum.value += i;
  }
});
</script>

<template>
  <div>
    <button @click="add">累加</button>
  </div>
  <div>
    <h1>累加结果：{{ sum }}</h1>
  </div>
</template>
<style scoped></style>
